package ${basePackage}.common;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.io.Serializable;
import java.util.List;

/**
 * 通用分页响应封装。
 */
@Getter
@AllArgsConstructor
public class PageResponse<T> implements Serializable {

    private static final long serialVersionUID = 1L;

    private final long total;
    private final long page;
    private final long size;
    private final List<T> records;

    public static <T> PageResponse<T> of(List<T> records, long total, long page, long size) {
        return new PageResponse<>(total, page, size, records);
    }
}
